package com.isoft.hospital.service.impl;

import com.isoft.hospital.common.ResponseData;
import com.isoft.hospital.dao.Jiuzhen1Dao;
import com.isoft.hospital.entity.Jiuzhen1;
import com.isoft.hospital.service.Jiuzhen1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class Jiuzhen1ServiceImpl implements Jiuzhen1Service {
    @Autowired
    private Jiuzhen1Dao dao;


    @Override
    public ResponseData selectAll() {
        List<Jiuzhen1> list=new ArrayList<>();
        list=dao.selectAll();
        ResponseData rd=new ResponseData();
        if(list!=null){
            rd.setCode(0);
            rd.setMsg("查询成功");
            rd.setData(list);

        }else {
            rd.setMsg("查询失败");
            rd.setCode(1);
        }
        return rd;
    }
    @Override
    public ResponseData queryByPid(int p_id) {
        List<Jiuzhen1> list=new ArrayList<>();
        list=dao.queryByPid(p_id);
        ResponseData rd=new ResponseData();
        if(list!=null){
            rd.setCode(0);
            rd.setMsg("查询成功");
            rd.setData(list);
        }else{
            rd.setCode(1);
            rd.setMsg("查询失败");
        }
        return rd;
    }
}
